﻿using System;
using GameEditor.View;
using GameEditor.View.Components;
using GameEngine.View.Components;
using GameEngine;
using GameEditor.Commands;
using GameEngine.Model;
using GameEngine.View;
using GameEngine.Model.Data;

namespace GameEditor
{
    public abstract class GameEditorFacade
    {
        #region Mediator names
        //public const string GameEditorMediatorName = "GameEditorMediatorName";
        public const string GameEditorMenuMediatorName = "GameEditorMenuMediatorName";
        public const string ViewEditorMediatorName = "ViewEditorMediatorName";
        public const string ShapeEditorMediatorName = "ShapeEditorMediatorName";      
        public const string ThingTypeEditorMediatorName = "ThingTypeEditorMediatorName";
        public const string LevelEditorMediatorName = "LevelEditorMediatorName";
        public const string WorldEditorMediatorName = "WorldEditorMediatorName";
        public const string MapEditorMediatorName = "MapEditorMediatorName";
        public const string ThingEditorMediatorName = "ThingEditorMediatorName";
        public const string ResourceEditorMediatorName = "ResourceEditorMediatorName";
        #endregion

        #region Commands Consts
        //public const string CREATEGAMEEDITOR_COMMAND = "CREATEGAMEEDITOR_COMMAND";
        public const string CREATEGAMEEDITORMENU_COMMAND = "CREATEGAMEEDITORMENU_COMMAND";
        public const string CREATEVIEWEDITORMENU_COMMAND = "CREATEVIEWEDITORMENU_COMMAND";
        public const string CREATESHAPEEDITORMENU_COMMAND = "CREATESHAPEEDITORMENU_COMMAND";
        public const string CREATETHINGTYPEEDITORMENU_COMMAND = "CREATETHINGTYPEEDITORMENU_COMMAND";
        public const string CREATERESOURCEEDITORMENU_COMMAND = "CREATERESOURCEEDITORMENU_COMMAND";
        public const string CREATELEVELEDITORMENU_COMMAND = "CREATELEVELEDITORMENU_COMMAND";
        public const string CREATEWORLDEDITORMENU_COMMAND = "CREATEWORLDEDITORMENU_COMMAND";
        public const string CREATEMAPEDITORMENU_COMMAND = "CREATEMAPEDITORMENU_COMMAND";
        public const string CREATETHINGEDITORMENU_COMMAND = "CREATETHINGEDITORMENU_COMMAND";

        //public const string EDITORSTARTUP_COMMAND = "INITIALIZEGAMEEDITOR_COMMAND";
        //public const string EDITORFINISH_COMMAND = "FINALIZEGAMEEDITOR_COMMAND";
        public const string GAMEPROPERTIESEDITOR_MENUACTION_COMMAND = "MY_PAGE_GAMEEDITORMENU_ACTION_COMMAND";
        public const string RESOURCEEDITORMENU_ACTION_COMMAND = "MY_PAGE_RESOURCEEDITORMENU_ACTION_COMMAND";
        public const string VIEWPROPERTIESEDITOR_MENUACTION_COMMAND = "MY_PAGE_VIEWEDITORMENU_ACTION_COMMAND";
        public const string SHAPEPROPERTIESEDITOR_MENUACTION_COMMAND = "SHAPEEDITORMENU_ACTION_COMMAND";
        public const string THINGTYPEEDITORMENU_ACTION_COMMAND = "MY_PAGE_THINGTYPEEDITORMENU_ACTION_COMMAND";
        public const string LEVELPROPERTIESEDITOR_MENUACTION_COMMAND = "MY_PAGE_LEVELEDITORMENU_ACTION_COMMAND";
        public const string WORLDPROPERTIESEDITOR_MENUACTION_COMMAND = "MY_PAGE_WORLDEDITORMENU_ACTION_COMMAND";
        public const string THINGPROPERTIESEDITOR_MENUACTION_COMMAND = "MY_PAGE_THINGEDITORMENU_ACTION_COMMAND";
        //public const string MAPEDITORMENU_ACTION_COMMAND = "MY_PAGE_MAPEDITORMENU_ACTION_COMMAND";
        #endregion

        static protected GameEditorFacade instance;
        public static GameEditorFacade Instance
        {
            get
            {
                return instance;
            }
        }
        
        protected GameEditorFacade()
        {
            instance = this;
            CreateViewFacade();
            CreateModelFacade();
        }
        
        protected abstract void CreateViewFacade();
        protected abstract void CreateModelFacade();
    }

    public abstract class GameEditorViewFacade<MyIdType>
        where MyIdType : IComparable<MyIdType>
    {
        static GameEditorViewFacade<MyIdType> instance;
        public static GameEditorViewFacade<MyIdType> Instance
        {
            get
            {
                return instance;
            }
        }
        public GameEditorViewFacade()
        {
            instance = this;
            //GameDataProxy = game;
            InitializeController();
        }

        virtual protected void InitializeController()
        {
            //ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATEGAMEEDITOR_COMMAND, typeof(CreateGameEditor_Command<MyGameEditorView, MyGameEditorMenuView, MyLevelEditorMenuView, MyWorldEditorMenuView, MyMapEditorMenuView, MyResourceEditorMenuView, MyViewEditorMenuView, MyShapeEditorMenuView,MyThingTypeEditorMenuView, MyThingEditorMenuView, MyGameView, MyLevelView, MyWorldView, MyMapView, MyItemView, MyBaseUIElementType, MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATEGAMEEDITORMENU_COMMAND, typeof(CreateGameEditorMenu_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATEVIEWEDITORMENU_COMMAND, typeof(CreateViewPropertiesEditor_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATESHAPEEDITORMENU_COMMAND, typeof(CreateShapePropertiesEditor_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATETHINGTYPEEDITORMENU_COMMAND, typeof(CreateThingTypePropertiesEditor_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATELEVELEDITORMENU_COMMAND, typeof(CreateLevelEditor_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATEWORLDEDITORMENU_COMMAND, typeof(CreateWorldEditor_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATEMAPEDITORMENU_COMMAND, typeof(CreateMapEditor_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATETHINGEDITORMENU_COMMAND, typeof(CreateThingEditor_Command<MyIdType>));
            ApplicationFacade.Instance.RegisterCommand(GameEditorFacade.CREATERESOURCEEDITORMENU_COMMAND, typeof(CreateResourceEditor_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.GAMEPROPERTIESEDITOR_MENUACTION_COMMAND,
                typeof(GamePropertiesEditor_MenuAction_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.RESOURCEEDITORMENU_ACTION_COMMAND,
                typeof(Page_ResourceEditorMenu_Action_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.VIEWPROPERTIESEDITOR_MENUACTION_COMMAND,
                typeof(Page_ViewEditorMenu_Action_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.SHAPEPROPERTIESEDITOR_MENUACTION_COMMAND,
                typeof(ShapeEditorMenu_Action_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.THINGTYPEEDITORMENU_ACTION_COMMAND,
                typeof(Page_ThingTypeEditorMenu_Action_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.LEVELPROPERTIESEDITOR_MENUACTION_COMMAND,
                typeof(Page_LevelEditorMenu_Action_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.WORLDPROPERTIESEDITOR_MENUACTION_COMMAND,
                typeof(Page_WorldPPropertiesEditor_MenuAction_Command<MyIdType>));

            ApplicationFacade.Instance.RegisterCommand(
                GameEditorFacade.THINGPROPERTIESEDITOR_MENUACTION_COMMAND,
                typeof(ThingPropertiesEditor_MenuAction_Command<MyIdType>));

        }
        
        #region Create Mediators
        //virtual public GameEditorMediator<MyGameEditorView, MyGameEditorMenuView, MyLevelEditorMenuView, MyWorldEditorMenuView, MyMapEditorMenuView, MyResourceEditorMenuView, MyViewEditorMenuView, MyShapeEditorMenuView,MyThingTypeEditorMenuView, MyThingEditorMenuView, MyGameView, MyLevelView, MyWorldView, MyMapView, MyItemView, MyBaseUIElementType, MyIdType> 
        //    CreateGameEditorMediator(
        //    string name, MyGameEditorView view, IGameDataProxy<MyIdType> gameDataProxy,
        //    WorldMediator<MyWorldView,MyMapView,MyItemView,MyIdType,MyBaseUIElementType> worldMediator,
        //    //GameMediator<MyGameView, MyLevelView, MyWorldView, MyMapView, MyItemView, MyIdType, MyBaseUIElementType> gameMediator,
        //    GamePropertiesEditor_MenuMediator<MyGameEditorMenuView, MyIdType> gameEditorMenuMediator,
        //    LevelPropertiesEditor_MenuMediator<MyLevelEditorMenuView, MyIdType> levelEditorMenuMediator,
        //    WorldPropertiesEditor_MenuMediator<MyWorldEditorMenuView, MyIdType> worldEditorMenuMediator,
        //    MapPropertiesEditor_Mediator<MyMapEditorMenuView, MyMapView, MyItemView, MyIdType,MyBaseUIElementType> mapEditorMenuMediator,
        //    //ResourcePropertiesEditor_MenuMediator<MyResourceEditorMenuView, MyIdType> resourceEditorMenuMediator,
        //    //ViewPropertiesEditor_MenuMediator<MyViewEditorMenuView, MyIdType> viewEditorMenuMediator,
        //    //ThingTypePropertiesEditor_MenuMediator<MyThingTypeEditorMenuView, MyIdType> thingTypeEditorMenuMediator, 
        //    ThingPropertiesEditor_MenuMediator<MyThingEditorMenuView, MyIdType> thingEditorMenuMediator,
        //    string outCommand
        //    )
        //{
        //    return new GameEditorMediator<MyGameEditorView, MyGameEditorMenuView, MyLevelEditorMenuView, MyWorldEditorMenuView, MyMapEditorMenuView, MyResourceEditorMenuView, MyViewEditorMenuView, MyShapeEditorMenuView,MyThingTypeEditorMenuView, MyThingEditorMenuView, MyGameView, MyLevelView, MyWorldView, MyMapView, MyItemView, MyBaseUIElementType, MyIdType>(
        //        name, view,
        //        gameDataProxy,
        //        worldMediator,
        //        gameEditorMenuMediator,
        //        levelEditorMenuMediator,
        //        worldEditorMenuMediator,
        //        mapEditorMenuMediator,
        //        //resourceEditorMenuMediator, 
        //        //viewEditorMenuMediator, 
        //        //thingTypeEditorMenuMediator, 
        //        thingEditorMenuMediator,
        //        outCommand
        //        );
        //}

        virtual public GamePropertiesEditor_MenuMediator<MyIdType> CreateGameEditorMenuMediator(string name, IGameEditorMenuView<MyIdType> view, IGameDataProxy<MyIdType> proxy)
        {
            return new GamePropertiesEditor_MenuMediator<MyIdType>(name, view, proxy, GameEditorFacade.GAMEPROPERTIESEDITOR_MENUACTION_COMMAND);
        }

        virtual public LevelPropertiesEditor_MenuMediator<MyIdType> CreateLevelEditorMenuMediator(string name, ILevelEditorMenuView<MyIdType> view)
        {
            return new LevelPropertiesEditor_MenuMediator<MyIdType>(name, view, GameEditorFacade.LEVELPROPERTIESEDITOR_MENUACTION_COMMAND);
        }

        virtual public WorldPropertiesEditor_MenuMediator<MyIdType> CreateWorldEditorMenuMediator(string name, IWorldEditorMenuView<MyIdType> view, IWorldDataProxy<MyIdType> worldDataProxy)
        {
            return new WorldPropertiesEditor_MenuMediator<MyIdType>(name, view, GameEditorFacade.WORLDPROPERTIESEDITOR_MENUACTION_COMMAND, worldDataProxy);
        }

        virtual public MapPropertiesEditor_Mediator<MyIdType> CreateMapEditorMenuMediator(string name, IMapEditorMenuView view, IMapDataProxy<MyIdType> mapDataProxy)
        {
            return new MapPropertiesEditor_Mediator<MyIdType>(name, view, mapDataProxy);
        }

        virtual public ViewPropertiesEditor_MenuMediator<MyIdType> CreateViewEditorMenuMediator(string name, IViewEditorMenuView<MyIdType> view, IViewDataProxy<MyIdType> proxy)
        {
            return new ViewPropertiesEditor_MenuMediator<MyIdType>(name, view, proxy, GameEditorFacade.VIEWPROPERTIESEDITOR_MENUACTION_COMMAND);
        }

        virtual public ShapePropertiesEditor_MenuMediator<MyIdType> CreateShapeEditorMenuMediator(string name, IShapeEditorMenuView<MyIdType> view, IViewDataProxy<MyIdType> proxy, IShapeVOId shape)
        {
            return new ShapePropertiesEditor_MenuMediator<MyIdType>(name, view, proxy, shape, GameEditorFacade.SHAPEPROPERTIESEDITOR_MENUACTION_COMMAND);
        }

        virtual public ThingPropertiesEditor_MenuMediator<MyIdType> CreateThingEditorMenuMediator(string name, IThingEditorMenuView<MyIdType> view, IThingDataProxy<MyIdType> proxy)
        {
            return new ThingPropertiesEditor_MenuMediator<MyIdType>(name, view,proxy,GameEditorFacade.THINGPROPERTIESEDITOR_MENUACTION_COMMAND);
        }

        virtual public ThingTypePropertiesEditor_MenuMediator<MyIdType> CreateThingTypeEditorMenuMediator(string name, IThingTypeEditorMenuView<MyIdType> view)
        {
            return new ThingTypePropertiesEditor_MenuMediator<MyIdType>(name, view);
        }

        virtual public ResourcePropertiesEditor_MenuMediator<MyIdType> CreateResourceEditorMenuMediator(string name, IResourceEditorMenuView<MyIdType> view, IResourceDataProxy proxy)
        {
            return new ResourcePropertiesEditor_MenuMediator<MyIdType>(name, view, proxy, GameEditorFacade.RESOURCEEDITORMENU_ACTION_COMMAND);
        }
        #endregion

        #region Views
        //abstract public MyGameEditorView CreateGameEditorView();

        abstract public IGameEditorMenuView<MyIdType> CreateGameEditorMenuView();

        abstract public ILevelEditorMenuView<MyIdType> CreateLevelEditorMenuView();

        abstract public IWorldEditorMenuView<MyIdType> CreateWorldEditorMenuView();

        abstract public IMapEditorMenuView CreateMapEditorMenuView();

        abstract public IViewEditorMenuView<MyIdType> CreateViewEditorMenuView();

        abstract public IShapeEditorMenuView<MyIdType> CreateShapeEditorMenuView();

        abstract public IThingEditorMenuView<MyIdType> CreateThingEditorMenuView();

        abstract public IThingTypeEditorMenuView<MyIdType> CreateThingTypeEditorMenuView();

        abstract public IResourceEditorMenuView<MyIdType> CreateResourceEditorMenuView();
        #endregion

        public class Helper {

            /// <summary>
            /// Start the application
            /// </summary>
            /// <param name="app">Application (App.xml)</param>
            /// <param name="useDesktop">Use or not the DesktiopMediator who controls the mainscreen</param>
            /// <param name="firstScreen">The first UserControl to show</param>
            //public static MyGameEditorView Start(IGameVO<MyIdType> dataProxy, string outCommand)
            //{
            //    ApplicationFacade.Instance.SendNotification(GameEditorFacade.EDITORSTARTUP_COMMAND, dataProxy, outCommand);
            //    //SilverlightApplicationFacadeHelper.DesktopNavigate(SilverlightEditorViewFacade.Helper.GetGameEditorMediator().ViewComponent);
            //    return GetGameEditorMediator().ViewComponent;
            //}

            #region CreateMediators
            //public static GameEditorMediator<MyGameEditorView, MyGameEditorMenuView, MyLevelEditorMenuView, MyWorldEditorMenuView, MyMapEditorMenuView, MyResourceEditorMenuView, MyViewEditorMenuView,MyShapeEditorMenuView, MyThingTypeEditorMenuView, MyThingEditorMenuView, MyGameView, MyLevelView, MyWorldView, MyMapView, MyItemView, MyBaseUIElementType, MyIdType> 
            //    CreateGameEditor(
            //    IGameDataProxy<MyIdType> dataProxy,
            //    WorldMediator<MyWorldView,MyMapView,MyItemView,MyIdType,MyBaseUIElementType> worldMediator,
            //    GamePropertiesEditor_MenuMediator<MyGameEditorMenuView, MyIdType> gameEditorMenu,
            //    LevelPropertiesEditor_MenuMediator<MyLevelEditorMenuView, MyIdType> levelEditorMenu,
            //    WorldPropertiesEditor_MenuMediator<MyWorldEditorMenuView, MyIdType> worldEditorMenu,
            //    MapPropertiesEditor_Mediator<MyMapEditorMenuView, MyMapView, MyItemView, MyIdType, MyBaseUIElementType> mapEditorMenu,
            //    //ResourceEditorMenuMediator<MyResourceEditorMenuView, MyIdType> resourceEditorMenu,
            //    //ViewEditorMenuMediator<MyViewEditorMenuView, MyIdType> viewEditorMenu,
            //    //ThingTypeEditorMenuMediator<MyThingTypeEditorMenuView, MyIdType> thingTypeEditorMenu,
            //    ThingPropertiesEditor_MenuMediator<MyThingEditorMenuView, MyIdType> thingEditorMenu,
            //    string outCommand
            //    )
            //{
            //    ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATEGAMEEDITOR_COMMAND, dataProxy,outCommand);
            //    return GetGameEditorMediator();
            //}

            public static GamePropertiesEditor_MenuMediator<MyIdType> CreateGamePropertiesEditor(IGameDataProxy<MyIdType> dataProxy)
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATEGAMEEDITORMENU_COMMAND, dataProxy);
                return GetGameEditorMenuMediator();
            }

            public static LevelPropertiesEditor_MenuMediator<MyIdType> CreateLevelPropertiesEditor(ILevelDataProxy<MyIdType> dataProxy)
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATELEVELEDITORMENU_COMMAND, dataProxy);
                return GetLevelEditorMenuMediator();
            }

            public static ThingTypePropertiesEditor_MenuMediator<MyIdType> CreateThingTypePropertiesEditor()
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATETHINGTYPEEDITORMENU_COMMAND);
                return GetThingTypeEditorMenuMediator();
            }

            public static ViewPropertiesEditor_MenuMediator<MyIdType> CreateViewPropertiesEditor(IViewDataProxy<MyIdType> dataProxy)
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATEVIEWEDITORMENU_COMMAND,dataProxy);
                return GetViewEditorMenuMediator();
            }

            public static ShapePropertiesEditor_MenuMediator<MyIdType> CreateShapePropertiesEditor(IViewDataProxy<MyIdType> dataProxy,IShapeVOId shape)
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATEVIEWEDITORMENU_COMMAND, dataProxy,shape.Value);
                return GetShapeEditorMenuMediator();
            }

            public static ResourcePropertiesEditor_MenuMediator<MyIdType> CreateResourceEditorMenu()
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATERESOURCEEDITORMENU_COMMAND);
                return GetResourceEditorMenuMediator();
            }

            public static WorldPropertiesEditor_MenuMediator<MyIdType> CreateWorldPropertiesEditor(IWorldDataProxy<MyIdType> dataProxy)
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATEWORLDEDITORMENU_COMMAND, dataProxy);
                return GetWorldEditorMenuMediator();
            }

            public static ThingPropertiesEditor_MenuMediator<MyIdType> CreateThingEditorMenu(IThingDataProxy<MyIdType> proxy)
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATETHINGEDITORMENU_COMMAND,proxy);
                return GetThingEditorMenuMediator();
            }

            public static MapPropertiesEditor_Mediator<MyIdType> CreateMapPropertiesEditor(IMapDataProxy<MyIdType> proxy)
            {
                ApplicationFacade.Instance.SendNotification(GameEditorFacade.CREATEMAPEDITORMENU_COMMAND, proxy);
                return GetMapEditorMenuMediator();
            }
            #endregion

            #region GetMediators
            //public static GameEditorMediator<MyGameEditorView, MyGameEditorMenuView, MyLevelEditorMenuView, MyWorldEditorMenuView, MyMapEditorMenuView, MyResourceEditorMenuView, MyViewEditorMenuView, MyShapeEditorMenuView,MyThingTypeEditorMenuView, MyThingEditorMenuView, MyGameView, MyLevelView, MyWorldView, MyMapView, MyItemView, MyBaseUIElementType, MyIdType> GetGameEditorMediator()
            //{
            //    return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.GameEditorMediatorName) as GameEditorMediator<MyGameEditorView, MyGameEditorMenuView, MyLevelEditorMenuView, MyWorldEditorMenuView, MyMapEditorMenuView, MyResourceEditorMenuView, MyViewEditorMenuView,MyShapeEditorMenuView, MyThingTypeEditorMenuView, MyThingEditorMenuView, MyGameView, MyLevelView, MyWorldView, MyMapView, MyItemView, MyBaseUIElementType, MyIdType>;
            //}

            public static GamePropertiesEditor_MenuMediator<MyIdType> GetGameEditorMenuMediator() {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.GameEditorMenuMediatorName) as GamePropertiesEditor_MenuMediator<MyIdType>;
            }

            public static LevelPropertiesEditor_MenuMediator<MyIdType> GetLevelEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.LevelEditorMediatorName) as LevelPropertiesEditor_MenuMediator<MyIdType>;
            }

            public static WorldPropertiesEditor_MenuMediator<MyIdType> GetWorldEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.WorldEditorMediatorName) as WorldPropertiesEditor_MenuMediator<MyIdType>;
            }

            public static MapPropertiesEditor_Mediator<MyIdType> GetMapEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.MapEditorMediatorName) as MapPropertiesEditor_Mediator<MyIdType>;
            }

            public static ThingPropertiesEditor_MenuMediator<MyIdType> GetThingEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.ThingEditorMediatorName) as ThingPropertiesEditor_MenuMediator<MyIdType>;
            }

            public static ViewPropertiesEditor_MenuMediator<MyIdType> GetViewEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.ViewEditorMediatorName) as ViewPropertiesEditor_MenuMediator<MyIdType>;
            }

            public static ShapePropertiesEditor_MenuMediator<MyIdType> GetShapeEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.ShapeEditorMediatorName) as ShapePropertiesEditor_MenuMediator<MyIdType>;
            }

            public static ThingTypePropertiesEditor_MenuMediator<MyIdType> GetThingTypeEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.ThingTypeEditorMediatorName) as ThingTypePropertiesEditor_MenuMediator<MyIdType>;
            }

            public static ResourcePropertiesEditor_MenuMediator<MyIdType> GetResourceEditorMenuMediator()
            {
                return ApplicationFacade.Instance.RetrieveMediator(GameEditorFacade.LevelEditorMediatorName) as ResourcePropertiesEditor_MenuMediator<MyIdType>;
            }
            #endregion
        }
    }

    public class GameEditorModelFacade<MyIdType>
        where MyIdType : IComparable<MyIdType>
    {
        static GameEditorModelFacade<MyIdType> instance;
        public static GameEditorModelFacade<MyIdType> Instance
        {
            get
            {
                return instance;
            }
        }
        public GameEditorModelFacade()
        {
            instance = this;
            //GameDataProxy = game;
        }

    }
}
